#@layout()

#define content()

<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:true">
        <div id="datagridId"></div>

        <div id="datagridTb">
            <div class="row">
                <div class="col-md-12">
                    <form id="searchForm">
                        <div class="easyui-panel" title="信息查询" style="width:100%;padding:10px;"
                             data-options="iconCls:'icon-application_form'">

                            #(_res.get('user.form.username')): <input class="easyui-textbox" id="userName" style="width:200px">&nbsp;&nbsp;
                            #(_res.get('oprlog.form.oprconent')): <input class="easyui-textbox" id="oprContent" style="width:200px">&nbsp;&nbsp;

                            <a href="javascript:;" class="easyui-linkbutton" data-options="plain:true" onclick="datagridQuery();" iconCls="icon-zoom">#(_res.get('system.common.search'))</a>
                            <a href="javascript:;" class="easyui-linkbutton" data-options="plain:true" onclick="$('#searchForm').form('clear');" iconCls="icon-zoom_out">#(_res.get('system.common.clear'))</a>
                        </div>
                    </form>
                </div>
                <div class="row">
                    <div class="col-md-12" style="padding: 5px 25px;">
                        #for(resource : resourceList)
                        <a href="javascript:;" class="easyui-linkbutton" data-options="iconCls:'#(resource.icon)',plain:true" id='#(resource.url)'>#(_res.get(resource.resourceName))</a>
                        #end
                    </div>
                </div>
            </div>
        </div>
    </div>




</div>

#end


#define css()

#end


#define js()

<script type="text/javascript">
    var _datagrid = "datagridId", _form = "formId", _datagridTb = "datagridTb";
    var datagridListUrl = contextRootPath + '/operLog/list';

    $(function () {

        //初始化表格
        $("#" + _datagrid).datagrid({
            url: datagridListUrl,
            fit: true,
            border: false,
            rownumbers: true,
            pageSize: 30,
            toolbar: '#' + _datagridTb,
            singleSelect: false,
            pagination: true,
            nowrap: false,
            striped: true,
            fitColumns: true,
            columns: [[
                {
                    field: DbLogConst.TABLE_OPER_LOG.OPR_ID,
                    title: DbLogConst.TABLE_OPER_LOG.OPR_ID,
                    checkbox: true
                },
                {
                    field: DbLogConst.TABLE_OPER_LOG.USER_NAME,
                    title: "#(_res.get('user.form.username'))",
                    sortable: true
                },
                {
                    field: DbLogConst.TABLE_OPER_LOG.OPR_CONTENT,
                    title: "#(_res.get('oprlog.form.oprconent'))",
                    sortable: true
                },
                {
                    field: DbLogConst.TABLE_OPER_LOG.OPR_RESULT,
                    title: "#(_res.get('oprlog.form.result'))",
                    sortable: true,
                    formatter: function (value, row, index) {
                        var result;
                        if (row.opr_result == 0) {
                            result = "#(_res.get('auth.form.oprlog.success'))";
                        } else {
                            result = "#(_res.get('auth.from.oprlog.failure'))";
                        }
                        return result;
                    }
                },
                {
                    field: DbLogConst.TABLE_OPER_LOG.CAUSE,
                    title: "#(_res.get('oprlog.form.course'))",
                    sortable: true
                },
                {
                    field: DbLogConst.TABLE_OPER_LOG.ADDRESS,
                    title: "#(_res.get('oprlog.form.address'))",
                    sortable: true
                },
                {
                    field: 'createts',
                    title: "#(_res.get('fidolog.form.creates'))",
                    sortable: true
                }
            ]]
        });

    });


    function datagridQuery() {

        var flag = $("#searchForm").form('enableValidation').form('validate');

        if (!flag) return;

        $("#" + _datagrid).datagrid({
            queryParams: {
                "operLog.user_name": $('#userName').val(),
                'operLog.opr_content': $('#oprContent').val()
            }
        });
    }
</script>

#end



